/*
 * @Date: 2022-04-06 09:19:26
 * @Author: 陶子

 * @LastEditTime: 2023-05-11 10:39:11
 * @FilePath: \jk_one-stop_cloud_mobile_v1.0\src\api\mobile.js
 * @pageName: 这是--()--页面
 */
import {
    getAction,
    deleteAction,
    putAction,
    postAction,
    httpAction,
    fromDataPostAction,
    fromDataPostActionMultipart
} from '@/api/manage'
import {axios as request} from '@/utils/request'
//menu接口
export const menuDataApi = (params) => getAction('/newSys/permission/getAppPermission', params)
//意见反馈添加接口
export const feedbackAddApi = (data) => postAction('/home/erpFeedback/add', data)
//移动端首页-生产质检任务红点
export const findRedDotApi = (params) => getAction('/home/homePage/findRedDot', params)
//查询申请数量
export const applyNumApi = (params) => getAction("/proc/apply/queryApplyNum", params)
//生产质检任务-获取工序报工状态
export const processTaskCompletionStatics = (params) => getAction("/mess/messProductOrderTask/processTaskCompletionStatics", params)
// 工序
//生产质检任务-获取工序报工状态
export const basicProductionProcessesList = (params) => postAction("/basic/basicProductionProcesses/list", params)
//出入库记录管理-出入库类型下拉列表
export const outAinApi = (params) => getAction("/wms/wmsWarehouseOperate/getWmsInOutTaskTypeList", params)
//生产工单-查询所有工单编号字典
export const getOrderCodeDict = (params) => getAction("/mess/messProductOrder/getOrderCodeDict", params)
//生产质检任务-获取工序任务列表（包含报工情况）
export const getProcessOptions = (params) => getAction("/mess/messProductOrderTask/getProcessOptions", params)
// 生产质检任务 - 通过id查询
export const taskDetailApi = (params) => getAction("/mess/messProductOrderTask/queryById", params)
//生产质检任务-查询报工工序任务下的报工操作人
export const getReportTeamUserListByTaskId = (params) => getAction("/mess/messProductOrderTask/getReportTeamUserListByTaskId", params)
//报工记录-通过id查询
export const recordDetailApi = (params) => getAction("/mess/messTaskReportWorkApply/queryById", params)
//生产质检任务-添加报工
export const recordAdd = (data) => postAction("/mess/messTaskReportWorkApply/add", data)
//生产工单-通过id查询
export const workOrderDetailApi = (params) => getAction("/mess/messProductOrder/queryById", params)

// 申请发货
//选择客户
export const selectCustomerList = (params) => getAction('/salemgt/erpShippingApply/selectCustomerList', params) // 下拉-查询客户


export const erpShippingApplySelectByUserId = (params) =>
    getAction(`/salemgt/erpShippingApply/selectByUserId?customerId=${params}`) // 查询合同
export const findShippingItem = (params) => getAction(`/salemgt/erpShippingApply/findShippingItem?contractId=${params}`) // 表格明细
export const erpShippingApplyAdd = (params) => postAction('/salemgt/erpShippingApply/add', params) // 新建

export const shippingDetail = (params) => getAction(`/salemgt/erpShippingApply/shippingDetail?applyNo=${params}`) // 详情
//生产质检任务-通过id删除
export const deleteTaskApi = (params) => deleteAction("/mess/messProductOrderTask/delete", params)
// 批量删除出入库记录
export const batchDel = (params) => putAction("/wms/wmsWarehouseOperate/batchDel", params)

// /quick-platform查找索引通过模型id
export const getFileListByIds = (params) => getAction("/sys/common/getFileListByIds", params);

//报工记录-批量添加
export const reportBatchAdd = (data) => postAction("/mess/messTaskReportWorkApply/batchAdd", data)


// 申请采购
export const erpPurchaseTaskApplyAdd = (params) => postAction('/purchasemgt/erpPurchaseTaskApply/add', params) // 新建
export const erpPurchaseTaskApplyQueryById = (params) => getAction(`/purchasemgt/erpPurchaseTaskApply/queryById?id=${params}`) // 详情
//仓库下拉列表
export const stockListApi = (params) => getAction("/wms/wmsWarehouse/queryList", params)
// 入库单获取商品列表
export const inStockGoodApi = (params) => getAction("/wms/goods/getGoodsList", params)
//批量出入库
export const batchStockApi = (data) => postAction("/wms/wmsWarehouseOperate/add", data)


/* ------------------销售合同 begin------------------ */
export const erpSaleContractList = (params) => getAction("/salemgt/erpSaleContract/list", params); // 销售合同列表
export const erpCustomerList = (params) => getAction("/salemgt/erpCustomer/list", params); // 客户列表
export const erpSaleContractAdd = (params) => postAction("/salemgt/erpSaleContract/add", params); // 新建
export const erpSaleContractEdit = (params) => putAction("/salemgt/erpSaleContract/edit", params); // 编辑
export const erpSaleContractQueryById = (params) => getAction("/salemgt/erpSaleContract/queryById", params); // 编辑
export const findUnitListByGoodsId = (params) => getAction("/salemgt/erpSaleContract/findUnitListByGoodsId", params); // 根据商品查单位
export const erpSaleContractCompletedById = (params) => getAction("/salemgt/erpSaleContract/completedById", params); // 归档
export const erpProductOrderGetListVoByContractId = (params) => getAction("/planmgt/erpProductOrder/getListVoByContractId", params); // 生成订单根据合同查看明细
export const erpProductOrderProductOrderSubmit = (params) => postAction("/planmgt/erpProductOrder/productOrderSubmit", params); // 提交订单
/* ------------------销售合同 end------------------ */
/* ------------------供应商 begin------------------ */
export const erpSupplierAdd = (params) => postAction("/purchasemgt/erpSupplier/add", params); // 新建
export const erpSupplierEdit = (params) => putAction("/purchasemgt/erpSupplier/edit", params); // 编辑
export const erpSupplierList = (params) => getAction("/purchasemgt/erpSupplier/list", params); // 列表
export const erpSupplierQueryById = (params) => getAction("/purchasemgt/erpSupplier/queryById", params); // 详情
export const erpSupplierDelete = (params) => deleteAction("/purchasemgt/erpSupplier/delete", params); // 删除

/* ------------------采购合同 begin------------------ */
export const erpPurchaseContractAdd = (params) => postAction("/purchasemgt/erpPurchaseContract/add", params); // 新建
export const erpPurchaseContractEdit = (params) => putAction("/purchasemgt/erpPurchaseContract/edit", params); // 编辑
export const selectSupplierList = (params) => getAction("/purchasemgt/erpPurchaseContract/selectSupplierList", params); // 供应商下拉
export const selectTaskList = (params) => getAction("/purchasemgt/erpPurchaseContract/selectTaskList", params); // 采购任务下拉
export const erpPurchaseContractList = (params) => getAction("/purchasemgt/erpPurchaseContract/list", params); // 采购合同列表
export const erpPurchaseContractQueryById = (params) => getAction("/purchasemgt/erpPurchaseContract/queryById", params); // 采购合同详情
export const findTaskItemByTaskId = (params) => getAction("/purchasemgt/erpPurchaseContract/findTaskItemByTaskId", params); // 查询任务中商品信息
export const erpPurchaseSignOrderAdd = (params) => postAction("/purchasemgt/erpPurchaseSignOrder/add", params); // 签收
export const erpPurchaseSignOrderQueryById = (params) => getAction("/purchasemgt/erpPurchaseSignOrder/queryById", params); // 签收单详情
export const erpPurchaseContractCompletedById = (params) => getAction("/purchasemgt/erpPurchaseContract/completedById", params); // 归档
export const erpPurchaseTaskApplyList = (params) => getAction("/purchasemgt/erpPurchaseTaskApply/list", params); // 采购申请列表
export const erpPurchaseContractGetTaskByItemIds = (params) => getAction("/purchasemgt/erpPurchaseContract/getTaskByItemIds", params); // erp根据任务明细ids合并商品明细
/* ------------------采购合同 end------------------ */
//仓库物资管理-新建出入库清单选择仓库查询物资列表
export const queryGoodApi = (params) => getAction("/wms/wmsWarehouse/getOutGoodsList", params)
//出入库记录-通过id查询
export const queryByIdApi = (params) => getAction("/wms/wmsWarehouseOperate/queryById", params)
//出入库记录-通过id查询明细列表
export const queryListApi = (params) => getAction("/wms/wmsWarehouseOperate/queryPageListById", params)
//出入库记录-出入库单详情关联出入库任务商品分页
export const queryListByIdApi = (params) => getAction("/wms/wmsWarehouseOperate/queryListById", params)
//故障报修表-接收
export const receiveRepair = (data) => postAction("/assetmgt/messDeviceRepair/receiveRepair", data)
//故障报修表-派工
export const dispatch = (data) => postAction("/assetmgt/messDeviceRepair/dispatch", data)
//故障报修表-验证
export const verificationRepair = (data) => postAction("/assetmgt/messDeviceRepair/verificationRepair", data)
//设备详情
export const messDeviceQueryById = (params) => getAction(`/mess/device/queryById`, params);
//故障报修表-派工
export const repairAdd = (data) => postAction("/assetmgt/messDeviceRepair/add", data)
// 计件工资统计合计数据
export const getPieceRateStatisticsAmount = (params) => getAction("/mess/messProductReport/getPieceRateStatisticsAmount", params)
//删除物品
export const goodsLogicDel = (params) => deleteAction('/wms/goods/logicDelete', params)
//新增物品
export const goodsAdd = (params) => postAction('/wms/goods/add', params)
//编辑物品
export const goodsEdit = (params) => putAction('/wms/goods/edit', params)
// 新建查询出入库，出入库类型
export const OutInBoundTypeApi = (params) => getAction("/wms/wmsWarehouseOperate/getNewInOutTypeList", params)
// 根据工序查不合格操作人下拉
export const queryOperatorByFailedProcessId = (params) => getAction("/mess/messNotQualityHandleIinfo/queryOperatorByFailedProcessId", params)
//报工-可报工批次
export const queryBatchTaskReportList = (params) => getAction("/mess/messProductBatchTask/queryBatchTaskReportList", params)
//任务详情-批次信息
export const queryRelationBatchListByTaskId = (params) => getAction("/mess/messProductBatch/queryRelationBatchListByTaskId", params)
//生产批次-批次生产记录
export const queryProduceRecord = (params) => getAction("/mess/messProductBatch/queryProduceRecord", params)
//生产批次-列表
export const messProductBatchPageList = (params) => getAction("/mess/messProductBatch/pageList", params)
//任务详情-批次信息
export const relationBatchStaticsByTaskId = (params) => getAction("/mess/messProductBatch/relationBatchStaticsByTaskId", params)
//暂存-提交
export const pmDraftSave = (params) => putAction("/pm/draft/save", params)
//暂存-查询
export const pmDraftGet = (params) => getAction("/pm/draft/get", params)
//暂存-查询
export const pmDraftDel = (params) => deleteAction("/pm/draft/del", params)

//同步查询出库商品
export function getOutGoodsListForAllot(data) {
    return request({
        url: `/wms/wmsWarehouse/getOutGoodsListForAllot?id=${data.id}&warehouseId=${data.warehouseId}`,
        method: 'get',
        data
    })
}

//仓库是否被删除
export function wmsWarehouseQueryByIdIsExist(data) {
    return request({
        url: `/wms/wmsWarehouse/queryByIdIsExist?id=${data.id}`,
        method: 'get',
        data
    })
}

//物品是否被删除
export function goodsQueryByIdIsExist(data) {
    return request({
        url: `/wms/goods/queryByIdIsExist?id=${data.id}`,
        method: 'get',
        data
    })
}

// 物品单位下拉列表,过滤未启用的辅助单位(isUse:0启用，1未启用)
export function findUnitListByGoodsIdSync(data) {
    return request({
        url: `/salemgt/erpSaleContract/findUnitListByGoodsId?goodsId=${data.goodsId}&isUse=0`,
        method: 'get',
        data
    })
}

//新建调拨单
export const stockAllotAdd = (data) => postAction("/jksaas-produce/produce/wms/wmsStockAllot/add", data)
// 调拨详情
export const stockAllotDetail = (data) => getAction("/jksaas-produce/produce/wms/wmsStockAllot/queryById", data)

/* ------------------入库单 begin------------------ */
export const formTypeExtendedFieldList = (data) => getAction("/jksaas-produce/produce/basicDynamicFieldConfig/getFormTypeExtendedField", data) // 出入库单自定义表单字段

export const inventoryOrderTypeList = (data) => getAction("/warehouse/warehouseEntryInfo/entryType", data) // 入库单类型
export const inventoryOrderAdd = (data) => postAction("/warehouse/warehouseEntryInfo/add", data) // 新建入库单
export const inventoryOrDerdelete = (params) => deleteAction("/warehouse/warehouseEntryInfo/delete", params) // 删除入库单
export const inventoryOrDerEdit = (params) => putAction('/warehouse/warehouseEntryInfo/edit', params) // 编辑入库单
export const inventoryOrderDetail = (data) => getAction("/warehouse/warehouseEntryInfo/queryById", data) // 入库单详情 - 基本信息
export const inventoryOrderDetailList = (data) => getAction("/warehouse/warehouseEntryDetail/list", data) // 入库单详情 - 关联物品
/* ------------------入库单 end-  ----------------- */


/* ------------------出库单 begin------------------ */
// export const formTypeExtendedFieldList = (data) => getAction("/basicDynamicFieldConfig/getFormTypeExtendedField", data) // 出库单自定义表单字段

export const outboundOrderTypeList = (data) => getAction("/common/enum/getDictItemsByType", data) // 出库+入库业务类型
export const outboundOrderAdd = (data) => postAction("/warehouse/WarehouseOutboundOrderInfo/add", data) // 新建出库单
export const outboundOrderdelete = (params) => deleteAction("/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/delete", params) // 删除出库单
export const outboundOrderEdit = (params) => postAction('/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/edit', params) // 编辑出库单
export const outboundOrderDetail = (data) => getAction("/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/getById", data) // 出库单详情 - 基本信息
export const getOutboundOrderNotification = (data) => getAction("/jksaas-produce/produce/wmsgoodsnotification/getOutboundOrderNotification", data) // 出库单-物品查询
export const getGoodsById = (data) => getAction("/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/getGoodsById", data) // 出库单-物品查询
export const wmsWarehouseOperateQueryByPage = (data) => getAction("/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/queryByPage", data) // 出库单-查询
export const outboundOrderDetailList = (data) => getAction("/jksaas-produce/produce/warehouse/warehouseEntryDetail/list", data) // 出库单详情 - 关联物品
/* ------------------出库单 end-  ----------------- */


/* ------------------出库任务 begin------------------ */
// export const formTypeExtendedFieldList = (data) => getAction("/basicDynamicFieldConfig/getFormTypeExtendedField", data) // 出库单自定义表单字段

export const outboundTasksTypeList = (data) => getAction("/warehouse/WarehouseoutboundTasksInfo/entryType", data) // 出库任务类型
export const outboundTasksAdd = (data) => postAction("/jksaas-produce/produce/outboundTask/add", data) // 新建出库任务
export const outboundTasksList = (data) => getAction("/jksaas-produce/produce/outboundTask/wholeList", data) // 新建出库任务
export const outboundTasksdelete = (params) => deleteAction("/jksaas-produce/produce/outboundTask/delete", params) // 删除出库任务
export const outboundTasksEdit = (params) => postAction('/jksaas-produce/produce/outboundTask/edit', params) // 编辑出库任务
export const outboundTasksDetail = (data) => getAction("/jksaas-produce/produce/outboundTask/queryById", data) // 出库单详情 - 基本信息
export const pickingTTasksDetailList = (data) => getAction("/jksaas-produce/produce/wmsPickingTask/wholeList", data) // 出库任务拣货记录
export const getBatchCodeByGoodsId = (data) => getAction("/jksaas-produce/produce/wmsgoodsnotification/getBatchCodeByGoodsId", data) // 出库任务拣货记录
export const wmsPickingTaskAdd = (data) => postAction("/jksaas-produce/produce/wmsPickingTask/add", data) // 添加下发拣货
/* ------------------出库任务 end-  ----------------- */


/* ------------------拣货任务 begin------------------ */
// export const formTypeExtendedFieldList = (data) => getAction("/basicDynamicFieldConfig/getFormTypeExtendedField", data) // 出库单自定义表单字段

// export const outboundTasksTypeList = (data) => getAction("/warehouse/WarehouseoutboundTasksInfo/entryType", data) // 出库任务类型
export const wmsPickingTaskVerification = (data) => postAction("/jksaas-produce/produce/wmsPickingTask/verification", data) // 新建出库任务
export const wmsPickingTaskdelete = (params) => deleteAction("/jksaas-produce/produce/wmsPickingTask/delete", params) // 删除出库任务
// export const outboundTasksEdit = (params) => putAction('/jksaas-produce/produce/outboundTask/edit', params) // 编辑出库任务
export const wmsPickingTaskQueryById = (data) => getAction("/jksaas-produce/produce/wmsPickingTask/queryById", data) // 拣货任务详情 - 基本信息
export const getOutboundOrderLatticeGoods = (data) => getAction("/jksaas-produce/produce/wmsgoodsnotification/getOutboundOrderLatticeGoods", data) // 拣货任务详情 - 基本信息
export const wmsWarehouseOperateAdd = (data) => postAction("/jksaas-produce/produce/inOutDocument/wmsWarehouseOperate/add", data) // 拣货任务详情 - 基本信息
// export const wmsPickingTaskdDetailsList = (data) => getAction("/jksaas-produce/produce/wmsPickingTask/detailsList", data) // 出库任务详情
/* ------------------拣货任务 end-  ----------------- */


// 查询库位详情
export const warehouseLatticeDetail = (data) => getAction("/jksaas-produce/produce/baseSetting/warehouseLattice/" + data) // 拣货任务详情 - 基本信息
export const getLatticeNotificationForOutBound = (goodsId, batchCode) => getAction("/jksaas-produce/produce/wmslattice/getLatticeNotificationForOutBound?goodsId=" + goodsId + '&batchCode=' + batchCode) // 拣货任务详情 - 基本信息


export const getLatticeNotificationProLoss = (data) => getAction("/jksaas-produce/produce/wmslattice/getLatticeNotificationProLoss",data) // 拣货任务详情 - 基本信息
export const getDistributeLatticeNotification = (data) => getAction("/jksaas-produce/produce/wmslattice/getDistributeLatticeNotification",data) // 批量下发拣货-查询库位

